<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var i = 5;

        function f() {
            var time = document.getElementById("time");
            i--;
            time.innerHTML = i;
            if (i == 1) {
                location.href = "//www.baidu.com";
            }
        }
    </script>
</head>
<body onload="setInterval(f,1000)">
<p>
    <b id="time">5</b>秒后跳转到<a id="a" href="//www.baidu.com">百度</a>
</p>
</body>
</html>